home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Color Picker SDK / Sample Code / ScrapPicker Sample / Sources ƒ / ScrapPicker.h < prev    next >
Encoding:
Text File  |  1997-06-13  |  5.7 KB  |  113 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        AppleRGBPicker.h
  3.     Copyright:    © 1995-1996 by Apple Computer, Inc., all rights reserved.
  4. */
  5.  
  6. //===============================================================================
  7. //
  8. //                                 ScrapPicker.h
  9. //
  10. //===============================================================================
  11.  
  12.  
  13. #include <ColorPicker.h>
  14. #include <Palettes.h>
  15. #include "PickerCommon.h"
  16. #include "ScrapPickerConstants.h"
  17.  
  18.  
  19. typedef CMRGBColor    CMPickerColor;
  20. typedef CMRGBColor    CMUserColor;
  21.  
  22.  
  23. typedef struct PickerStorage
  24. {
  25.     ComponentInstance    myself;                //   This particular Component instance.
  26.     GrafPtr                port;                //   The dialog/port picker is in.
  27.     long                flags;                //   Copy of flags passed in.
  28.     
  29.     PMColor                currPMColor;        //   The current color as selected by the user.
  30.     PMColor                origPMColor;        //   The original color passed in to the picker.
  31.     PMColor                wasColor;            //   Used for Undo.
  32.     PixPatHandle        newColorPat;        // * Pattern (RGB dither pat) used to display the new color.
  33.     PixPatHandle        origColorPat;        // * Pattern (RGB dither pat) used to display the original color.
  34.     Str255                prompt;                //   Prompt string passed in (we ignore it).
  35.     
  36.     ColorChangedUPP        colorProc;            //   The application's color changed procedure.
  37.     long                colorProcData;        //   The application's color changed data
  38.     SInt16                baseItem;            //   The index of our first dialog item.
  39.     SInt16                pictNumber;            //   Pict currently being viewed.
  40.     SInt16                numPicts;            //   Number of PICTs in the Scrapbook File.
  41.     SInt16                depth;                //   Pixel depth of device we're initially on.
  42.     Boolean                visible;            //   Are we visible yet?
  43.     Boolean                realPicker;            //   True if we passed initialization.
  44.     Boolean                active;                //   Are we active?
  45.     Boolean                useColorPats;        //   Patterns are pixpats instead of old-style patterns.
  46.     Boolean                calledNPickColor;    //   Were we called via the new NPickColor?
  47. } PickerStorage, *PickerStoragePtr, **PickerStorageHandle;
  48.  
  49. // * Requires explicit disposal.
  50.  
  51. //===================================================================== Prototypes
  52.  
  53.             // ScrapPickerEntry.c
  54. pascal ComponentResult main (ComponentParameters *params, Handle storage);
  55.  
  56.             // ScrapPicker.c
  57. pascal ComponentResult doPickerOpen                    (PickerStorageHandle, ComponentInstance);
  58. pascal ComponentResult doPickerClose                (PickerStorageHandle, ComponentInstance);
  59. pascal ComponentResult doPickerCanDo                (PickerStorageHandle, short);
  60. pascal ComponentResult doPickerVersion                (PickerStorageHandle);
  61. pascal ComponentResult doPickerRegister                (PickerStorageHandle);
  62. pascal ComponentResult doPickerSetTarget            (PickerStorageHandle, ComponentInstance);
  63. pascal ComponentResult doPickerInit                    (PickerStorageHandle, PickerInitData *);
  64. pascal ComponentResult doPickerGetDialog            (PickerStorageHandle);
  65. pascal ComponentResult doPickerTestGraphicsWorld    (PickerStorageHandle, PickerInitData *);
  66. pascal ComponentResult doPickerGetAttributes        (PickerStorageHandle);
  67. pascal ComponentResult doPickerGetColor                (PickerStorageHandle, ColorType, PMColorPtr);
  68. pascal ComponentResult doPickerSetColor                (PickerStorageHandle, ColorType, PMColorPtr);
  69. pascal ComponentResult doPickerEvent                (PickerStorageHandle, EventData *);
  70. pascal ComponentResult doPickerEdit                    (PickerStorageHandle, EditData *);
  71. pascal ComponentResult doPickerSetVisibility        (PickerStorageHandle, Boolean);
  72. pascal ComponentResult doPickerDisplay                (PickerStorageHandle);
  73. pascal ComponentResult doPickerItemHit                (PickerStorageHandle, ItemHitData *);
  74. pascal ComponentResult doPickerGetItemList            (PickerStorageHandle);
  75. pascal ComponentResult doPickerSetBaseItem            (PickerStorageHandle, short);
  76. pascal ComponentResult doPickerGetProfile            (PickerStorageHandle);
  77. pascal ComponentResult doPickerSetProfile            (PickerStorageHandle, CMProfileHandle);
  78. pascal ComponentResult doPickerGetPrompt            (PickerStorageHandle, Str255);
  79. pascal ComponentResult doPickerSetPrompt            (PickerStorageHandle, Str255);
  80. pascal ComponentResult doPickerGetIconData            (PickerStorageHandle, PickerIconData *);
  81. pascal ComponentResult doPickerGetEditMenuState        (PickerStorageHandle, PickerMenuState *);
  82. pascal ComponentResult doPickerSetOrigin            (PickerStorageHandle, Point);
  83. pascal ComponentResult doPickerExtractHelpItem        (PickerStorageHandle, short, short, HelpItemInfo *);
  84. pascal ComponentResult doPickerSetColorChangedProc    (PickerStorageHandle, ColorChangedUPP colorProc, long colorProcData);
  85. #if NEW_COLORPICKER_2_1_CALLS
  86. pascal ComponentResult doNPickerGetColor            (PickerStorageHandle, ColorType, NPMColorPtr);
  87. pascal ComponentResult doNPickerSetColor            (PickerStorageHandle, ColorType, NPMColorPtr);
  88. pascal ComponentResult doNPickerGetProfile            (PickerStorageHandle, CMProfileRef *);
  89. pascal ComponentResult doNPickerSetProfile            (PickerStorageHandle, CMProfileRef);
  90. pascal ComponentResult doNPickerSetColorChangedProc    (PickerStorageHandle, NColorChangedUPP colorProc, long colorProcData);
  91. #endif            // NEW_COLORPICKER_2_1_CALLS
  92.  
  93.                 // ScrapPickerDraw.c
  94. void    DrawColorEditor                    (PickerStorageHandle, UInt32);
  95. SInt16    OpenScrapBookFile                (void);
  96.  
  97.                 // ScrapPickerUtils.c
  98. void    ActivatePicker                    (PickerStorageHandle);
  99. void    DeactivatePicker                (PickerStorageHandle);
  100. OSErr    DoMouseDown                        (PickerStorageHandle, EventData *);
  101. OSErr    DoKeyDown                        (PickerStorageHandle, EventData *);
  102. OSErr    DoKeyUp                            (PickerStorageHandle, EventData *);
  103. OSErr    DoIdle                            (PickerStorageHandle, EventData *);
  104. void    CheckCurrentWorld                (PickerStorageHandle, short, ItemHitData *);
  105. void    CheckAllNumbers                    (PickerStorageHandle, EventData *);
  106. OSErr    DoListClick                        (PickerStorageHandle, ItemHitData *);
  107. Boolean    PtInItem                        (PickerStorageHandle, Point, short);
  108. void    GetItemRect                        (PickerStorageHandle, short, Rect *);
  109. Handle    GetItemHandle                    (PickerStorageHandle, short);
  110. void    SetColorPattern                    (PickerStorageHandle, ColorType);
  111. void    SelectDeselectItemText            (PickerStorageHandle, SInt16, Boolean);
  112.  
  113.